/**
 * MyActivity.java
 * 版权所有(C) 2014
 * 创建者:cuiran 2014-10-29 上午9:40:00
 */
package com.ghyf.mplay;

import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.audio.AudioServiceController;
import org.videolan.vlc.util.VLCInstance;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * 测试Activity 
 * @author cuiran
 * @version 1.0.0
 */
public class MyActivity extends Activity implements OnClickListener{

	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		  // Start LibVLC
        try {
			VLCInstance.getLibVlcInstance();
		} catch (LibVlcException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setContentView(R.layout.mybutton);
		findViewById(R.id.button1).setOnClickListener(this);
		
	}

	
	/* (non-Javadoc)
	 * @see android.app.Activity#onPause()
	 */
	@Override
	protected void onPause() {
		AudioServiceController.getInstance().unbindAudioService(this);
		super.onPause();
	}


	/* (non-Javadoc)
	 * @see android.app.Activity#onResume()
	 */
	@Override
	protected void onResume() {
		AudioServiceController.getInstance().bindAudioService(this);
		super.onResume();
	}


	@Override
	protected void onDestroy() {
		super.onDestroy();
	}


	/* (non-Javadoc)
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View v) {
		Intent intent=new Intent(this, MyDemoActivity.class);
		startActivity(intent);
		
		
		handler.postDelayed(myRunnable, 20000);
	}
	Handler handler=new Handler();
	private void close(){
		MyDemoActivity.instance.finish();
	}
Runnable myRunnable=new Runnable() {
		
		@Override
		public void run() {
			close();
		}
	};
	
	
}
